Derivation of dp transition by cumulative sum